package com.vains.config.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * 查询/ check_token端点以获取访问令牌的内容。 如果端点返回400响应，则表明令牌无效
 * @author vains
 * @date 2021/4/4 22:59
 */
@Data
@Component
@ConfigurationProperties(prefix = RemoteTokenServicesProperties.PREFIX)
public class RemoteTokenServicesProperties {

    static final String PREFIX = "security.oauth2";

    /**
     * 客户端信息
     */
    private Client client;

    /**
     * 客户端信息
     */
    private Resource resource;

    @Data
    public static class Client {

        /**
         * 客户端id
         */
        private String clientId = "authorizeResource";

        /**
         * 客户端秘钥
         */
        private String clientSecret = "123456";

    }

    @Data
    public static class Resource {

        /**
         * token信息地址
         */
        private String tokenInfoUri = "http://localhost:5000/auth-server/oauth/check_token";

        /**
         * 重定向url
         */
        private String redirectUri = "http://localhost:5000/test/test/getToken";

    }

}
